// 题意：给定n个城市，m个单向边，经过一条边有一个时间和花费。初始有R元钱，
//       一共有k个维度宇宙，除了1和n这两个城市只有0维度宇宙。每个维度每个
//       节点有个盐售价，每到一个节点（除了1和n），可以选择买一包盐，
//       卖一包盐，或者不做交易。任意时刻金钱不能为负。一到n节点就结束行程。
//       问在规定t时间内，如果可到n节点，能获得最大金钱是多少。
//
// 题解：dp。从初始状态往外bfs转移。某一时刻在队列可能同一状态会有多个，所以
//       记录一个inque避免重复。然后用priority_queue，按时间顺序枚举，这样
//       保证状态都是按时间枚举完，所以在当前状态枚举的时候可以保证一定是
//       最优的，故不会多次进入队列。
//
// run: $exec < input
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>

struct edge { int from; int to; int t; int m; };
struct state { int t; int k; int n; int b; };

bool operator<(state const & a, state const & b)
{
	return a.t > b.t;
}

int const maxn = 105;
int const maxk = 7;
int const maxt = 206;
int const maxb = 7;
int kth[maxk][maxn];
int dp[maxt][maxk][maxn][maxb];
bool inque[maxt][maxk][maxn][maxb];
int n, m, bag, ku, rmb, input_time;

std::vector<edge> graph[maxn];

void init()
{
	for (int i = 0; i < n; i++) graph[i].clear();
	std::memset(dp, -1, sizeof(dp));
	std::memset(inque, 0, sizeof(inque));
}

int next(int k) { return (k + 1) % ku; }

int main()
{
	int T;
	std::scanf("%d", &T);
	for (int ti = 1; ti <= T; ti++) {
		std::printf("Case #%d: ", ti);
		std::scanf("%d %d %d %d %d %d", &n, &m, &bag, &ku, &rmb, &input_time);

		init();

		for (int i = 0; i < ku; i++)
			for (int j = 0; j < n; j++)
				std::scanf("%d", &kth[i][j]);

		for (int i = 0, x, y, t, tm; i < m; i++) {
			std::scanf("%d %d %d %d", &x, &y, &t, &tm);
			//std::cin >> x >> y >> t >> tm;
			x--; y--;
			graph[x].push_back({x, y, t, tm});
		}


		dp[0][0][0][0] = rmb;
		std::priority_queue<state> q;
		q.push({0, 0, 0, 0});
		inque[0][0][0][0] = true;

		bool flag = false;
		while (!q.empty()) {
			state ts = q.top(); q.pop();
			int i = ts.t, k = ts.k, j = ts.n, b = ts.b;
			inque[i][k][j][b] = false;
			if ((!j || j == n - 1) && k) continue;
			if (j == n - 1) { flag = true; continue; }
			if (i >= input_time) continue;

			int tmp = dp[i][k][j][b];
		//	std::printf("time = %d  k = %d  dest = %d  bag = %d  dp = %d\n", i, k, j, b, tmp);

			// transfer
			for (int tj = 0; tj < (int)graph[j].size(); tj++) {
				edge e = graph[j][tj];
				if (i + e.t > input_time || e.m > tmp) continue;

				// do nothing
				if (tmp - e.m > dp[i + e.t][k][e.to][b]) {
					dp[i + e.t][k][e.to][b] = tmp - e.m;
					if (!inque[i + e.t][k][e.to][b]) {
						q.push({i + e.t, k, e.to, b});
						inque[i + e.t][k][e.to][b] = true;
					}
				}

				if (e.to == n - 1) { if (!k) flag = true; continue; }
				if (!e.to) continue;

				// sell
				if (b && tmp - e.m + kth[k][e.to] > dp[i + e.t][k][e.to][b - 1]) {
					dp[i + e.t][k][e.to][b - 1] = tmp - e.m + kth[k][e.to];
					if (!inque[i + e.t][k][e.to][b - 1]) {
						q.push({i + e.t, k, e.to, b - 1});
						inque[i + e.t][k][e.to][b - 1] = true;
					}
				}

				// bought
				if (b + 1 <= bag && tmp - e.m >= kth[k][e.to] && tmp - e.m - kth[k][e.to] > dp[i + e.t][k][e.to][b + 1]) {
					dp[i + e.t][k][e.to][b + 1] = tmp - e.m - kth[k][e.to];
					if (!inque[i + e.t][k][e.to][b + 1]) {
						q.push({i + e.t, k, e.to, b + 1});
						inque[i + e.t][k][e.to][b + 1] = true;
					}
				}
			}

			// universe transfer
			if (j) {
				// do nothing
				if (tmp > dp[i + 1][next(k)][j][b]) {
					dp[i + 1][next(k)][j][b] = tmp;
					if (!inque[i + 1][next(k)][j][b]) {
						q.push({i + 1, next(k), j, b});
						inque[i + 1][next(k)][j][b] = true;
					}
				}

				// sell
				if (b && tmp + kth[next(k)][j] > dp[i + 1][next(k)][j][b - 1]) {
					dp[i + 1][next(k)][j][b - 1] = tmp + kth[next(k)][j];
					if (!inque[i + 1][next(k)][j][b - 1]) {
						q.push({i + 1, next(k), j, b - 1});
						inque[i + 1][next(k)][j][b - 1] = true;
					}
				}

				// bought
				if (b + 1 <= bag && tmp >= kth[next(k)][j] && tmp - kth[next(k)][j] > dp[i + 1][next(k)][j][b + 1]) {
					dp[i + 1][next(k)][j][b + 1] = tmp - kth[next(k)][j];
					if (!inque[i + 1][next(k)][j][b + 1]) {
						q.push({i + 1, next(k), j, b + 1});
						inque[i + 1][next(k)][j][b + 1] = true;
					}
				}
			}
		}

		int ans = 0;
		for (int i = 0; i <= input_time; i++)
			for (int j = 0; j <= bag; j++)
				ans = std::max(ans, dp[i][0][n - 1][0]);

		if (!flag) std::printf("Forever Alone\n");
		else       std::printf("%d\n", ans);
	}
}

